<template>
	<view v-if="loading" style="padding: 5px 10px;">
		<view class="flex" style="margin-top: 10rpx;">
			<view class="biao" style="width: 100%;">
				<span class="biao_span1">4</span>
				<text class="cardTitle">{{text.contract}} </text>
				
				<view class="order_info_btn orange" style="float: right;margin-right: 15rpx;"
					v-if="order.orderInfo.is_compensation==1&&order.role==1&&order.orderJoin.is_compensation==0" @click="agreement()">
					{{$t("重新上传")}}
				</view>
				
				<view class="order_info_btn orange" style="float: right;margin-right: 15rpx;" v-if="scbtn"
					@click="agreement()">
					{{$t("上传")}}
				</view>
				<view class="order_info_btn orange" style="float: right;margin-right: 15rpx;"
					v-if="order.orderInfo.is_compensation==1&&order.role==2&&(order.orderJoin.is_compensation==0||order.orderJoin.is_compensation==null||order.orderJoin.is_compensation==2)"
					@click="agreement()">
					{{$t("待确认")}}
				</view>
				<view class="order_info_btn green" style="float: right;margin-right: 15rpx;"
					v-if="order.orderJoin.is_compensation==1&&order.orderInfo.is_compensation==1">
					{{$t("已确认")}}
				</view>
				<view style="float: right;font-size: 10px;line-height: 24px;margin-right: 10px;color: red;"
					v-if="order.orderInfo.is_compensation==1&&order.role==1&&order.orderInfo.compensation_standards&&order.orderJoin.is_compensation==0">{{$t("已上传")}}</view>
				<view style="clear: both;"></view>
			</view>
		</view>

		<view style="width: 95%;margin:0rpx 20rpx;padding: 20rpx 0rpx;">
			<view class="buy_files" v-if="order.orderInfo.compensation_standards" @click="agreement"
				style="position: relative;z-index: 33;">
				<view style="padding: 5px 10px;font-size: 20rpx;" class="downLoad">
					{{ $t(filelist) }}
				</view>
			</view>
			<view v-else-if="filelist&&!order.orderInfo.compensation_standards" style="position: relative;z-index: 33;">
				<view style="padding: 5px 10px;font-size: 20rpx;" class="downLoad">
					{{ $t("暂未上传") }}
				</view>
			</view>
		</view>

		<view style="width: 100%;">
			<view style="width:67%;float: left;" v-if="order.orderInfo.is_compensation==1">
				<block v-if="order.user_id==order.orderInfo.release_user_id">
					<view style="float: left;color: red;margin-bottom: 5%;font-size: 10px;margin-left: 10px;"
						v-if="(order.orderJoin.is_compensation==0||order.orderJoin.is_compensation==null)&&order.orderInfo.compensation_standards">
						{{$t("待对方确认")}}
					</view>
				</block>
				<view class="order_info_btn"
					style="float: left; text-align: left;color: rgb(56, 222, 106);font-size: 10px;"
					v-if="order.orderJoin.is_compensation==1&&order.role==1">
					{{$t("对方已确认")}}
				</view>
				<view class="order_info_btn" style="float: left; text-align: left;color: red;font-size: 10px;"
					v-if="order.orderJoin.is_compensation==2&&order.role==1">
					{{$t("对方已拒绝")}}
				</view>
				<view style="clear: both;"></view>
			</view>
			<view style="clear: both;"></view>
		</view>
		<view style="height: 15px;"></view>

	</view>
</template>


<script>
	import {
		HTTP_REQUEST_URL,
		HTTP_IMG_UTL,
		IMAGE_URL
	} from "@/config/app";
	export default {
		components: {

		},
		props: {
			order2: {
				type: [Array, Object, Number, String],
				default: {}
			},
		},
		data() {
			return {
				//远程域名
				HTTP_IMG_UTL,
				HTTP_REQUEST_URL,
				IMAGE_URL,
				url: IMAGE_URL,

				//语言
				lang: this.$i18n.locale,
				//文字
				text: {
					contract: this.$t('验货及赔付标准协议'),
					edit_xieyi: this.$t('编辑协议'),
					wait_upload: this.$t('待上传'),
					wait_confirm: this.$t('待对方确认'),
					wait_confirm2: this.$t('待确认'),
					other_confirm: this.$t('已确认'),
					is_confirm: this.$t('您已确认'),
					is_reject: this.$t('已拒绝'),
					is_upload: this.$t('已上传'),
				},
				loading: false,
				order: {},
				//协议文件
				filelist: this.$t("验货及赔付标准协议") + ".txt",
				scbtn: false,
			}
		},
		mounted() {
			this.order = this.order2
			console.log(this.order)
			this.sc_btn()
			this.loading = true
		},
		methods: {
			sc_btn() {
				if (this.order.orderInfo.is_compensation == 0 && this.order.role == 1) {
					this.scbtn = true;
				}
			},
			agreement() {
				uni.navigateTo({
					url: "/pages/textbook/agreementEdit?order_id=" + this.order.orderInfo.id + "&join_order_id=" +
						this.order.orderInfo.join_order_id
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	@import "@/common/orderDetail.scss";
</style>